GenerativeComponents Help

Boolean Operators

The following operators can be applied to any values of the type bool.

General Form Meaning / Remarks

b1 & b2

b1 && b2

and

The result is true if both b1 and b2 are true, otherwise the resule is false.

In the first form (&), the values of b1 and b2 are calculated first, then the 'and' operation is applied to those two values.

In the second form (&&) only b1 is calculated first. If that value is false, then b2 is not calculated, since the result of b1 && b2 is already known to be false.

The second form is sometimes called 'short circuiting' evaluation.

b1 | b2

b1 || b2

or

The result is true if either or both of b1 and b2 are true, otherwise the result is false.

In the first form (|), the values of b1 and b2 are calculated first, then the 'or' operation is applied to those two values.

In the second form (||), only b1 is calculated first. If that value is true, then b2 is not calculated, since the result of b1 || b2 is already known to be true.

The second form is sometimes called 'short circuiting' evaluation.

b1 ^ b2

exclusive or

The result is true if either, but not both, of b1 and b2 are true, otherwise the result is false

!b

not

The result is true if b is false. The result is false if b is true.